import time

from django.contrib import admin

# Register your models here.

from .models import UserProfile


class UserProfileAdmin(admin.ModelAdmin):
    list_display = ('nickname', 'mobile', 'gender')

    list_display_links = ('nickname',)  # 默认
    # sortable_by # 排序

    '''定义哪个字段可以编辑'''
    # list_editable = ('subscribe',)

    '''搜索框 ^, =, @, None=icontains'''
    search_fields = ['nickname', 'mobile']

    '''默认空值'''
    empty_value_display = 'NA'

    '''过滤选项'''
    list_filter = ('gender',)


class UserAdmin(admin.ModelAdmin):
    list_display = ('username', 'is_staff', 'is_superuser', 'date_joined',)

    # list_display_links = ('nickname', ) # 默认
    # sortable_by # 排序

    '''定义哪个字段可以编辑'''
    list_editable = ('is_staff', 'is_superuser')

    '''搜索框 ^, =, @, None=icontains'''
    search_fields = ['username']

    '''默认空值'''
    empty_value_display = 'NA'

    '''过滤选项'''
    list_filter = ('is_staff', 'is_superuser', 'gender')


admin.site.register(UserProfile, UserProfileAdmin)

# admin.site.hader
# 修改网页title和站点header。
admin.site.site_title = "新能源汽车产业链后台管理"
admin.site.site_header = "新能源汽车产业链后台"

